<template>
	<div>
		<el-form ref="form" :model="form" label-width="80px">

			<el-form-item label="检验名称">
				<el-input v-model="form.name"></el-input>
			</el-form-item>
			<el-form-item label="价格">
				<el-input v-model="form.fee"></el-input>
			</el-form-item>
			
			<el-form-item>
				<el-button type="primary" @click="save">保存</el-button>
			</el-form-item>
		</el-form>

	</div>
</template>

<script>
	export default {
		name: 'CheckItemEdit',
		components: {

		},
		props: [
			'showEdit',
			'id'
		],
		data() {
			return {
				form: {
					id: '',
					name: '',
					fee: '',
					active: null,
				}
			}
		},
		methods: {
			save() {


				this.axios.get('/inspect_item?type=save', (data) => {
					if (data) {
						this.$emit('update:showEdit', false);
						this.$emit('update');
					}

				}, this.form, '保存成功');

			}
		},
		created() {

			
			if (this.id) {
				//当修改的时候 需要根据用户的 id， 将数据查询到页面
				this.axios.get('/inspect_item?type=toEdit', (data) => {
					this.form = data;
				}, {
					id: this.id
				});

			}

		}
	}
</script>

<style>
</style>
